﻿<UserControl x:Class="Starehe.Views.EnterExamResults"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
      xmlns:local="clr-namespace:Starehe"
      xmlns:Controls="clr-namespace:Helper.Controls;assembly=Helper"
      mc:Ignorable="d" 
      d:DesignHeight="700" d:DesignWidth="984"
             Background="White">
    <Grid>
        <TextBlock HorizontalAlignment="Left" Margin="20,20,0,0" Style="{DynamicResource Title}"  Text="Enter Results" 
                   VerticalAlignment="Top"/>

        <TextBlock  HorizontalAlignment="Left" Margin="59,80,0,0" Text="Student ID" VerticalAlignment="Top" />
        <TextBox HorizontalAlignment="Left" Margin="120,80,0,0" Name="txtStudentId" VerticalAlignment="Top" Width="200" 
                         Text="{Binding Path=SelectedStudentID, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, Delay=10}"/>

        <TextBlock  HorizontalAlignment="Left" Margin="87,125,0,0" Text="Exam" VerticalAlignment="Top" />
        <ComboBox Height="23" HorizontalAlignment="Left" Margin="120,125,0,0" VerticalAlignment="Top" Width="200" 
        	SelectedValuePath="ExamID" 
        	DisplayMemberPath="NameOfExam"
        	ItemsSource="{Binding AllExams}"
        	SelectedValue="{Binding SelectedExamID, Mode=TwoWay}"/>

        <TextBlock HorizontalAlignment="Left" Margin="40,200,0,0" Style="{DynamicResource Title0}" Text="Subject Scores" VerticalAlignment="Top"/>

        <TextBlock  HorizontalAlignment="Left" Margin="76,245,0,0" Text="Subject" VerticalAlignment="Top" />
        <ComboBox Height="23" HorizontalAlignment="Left" Margin="120,245,0,0" VerticalAlignment="Top" Width="200"         	
            ItemsSource="{Binding AllSubjects}"
        	DisplayMemberPath="NameOfSubject" 
        	SelectedItem="{Binding SelectedSubject, Mode=TwoWay}"/>
        <TextBlock  HorizontalAlignment="Left" Margin="86,290,0,0" Text="Score" VerticalAlignment="Top" />
        <TextBox HorizontalAlignment="Left" Height="23" Margin="120,290,0,0" VerticalAlignment="Top" Width="150"
                 DataContext="{Binding SelectedSubject}"
                 Text="{Binding Score, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}" />
        <TextBlock  HorizontalAlignment="Left" Margin="70,335,0,0" x:Name="textBlock4" Text="Remarks" VerticalAlignment="Top" />
        <TextBox HorizontalAlignment="Left" Margin="120,335,0,0" 
        	Width="201" AcceptsReturn="True" VerticalScrollBarVisibility="Visible" Height="165" VerticalAlignment="Top" 
                 DataContext="{Binding SelectedSubject}"
                 Text="{Binding Remarks, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>

        <Button Content="Add" HorizontalAlignment="Left" Margin="245,515,0,0" VerticalAlignment="Top" Width="75"
        	Command="{Binding AddSubjectResultCommand}"/>

        <TextBlock  HorizontalAlignment="Left" Margin="350,80,0,0" Style="{DynamicResource Title0}" Text="Preview" VerticalAlignment="Top" />
        <DataGrid AutoGenerateColumns="False" Margin="350,109,30,50" IsReadOnly="False" 
                  DataContext="{Binding NewResult}"
                  ItemsSource="{Binding Entries, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                  CanUserAddRows="False" CanUserResizeRows="False" CanUserReorderColumns="False" 
                  CanUserDeleteRows="True" RowHeaderWidth="0" >
            <DataGrid.Columns>
                <DataGridTextColumn Header="Name of Subject" Width="120*"
Binding="{Binding NameOfSubject, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" IsReadOnly="True"/>
                <DataGridTextColumn Header="Score" Width="100*"
Binding="{Binding Score, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
               
                <DataGridTextColumn Header="Remarks" Width="100*"
Binding="{Binding Remarks, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
            </DataGrid.Columns>
        </DataGrid>
        <Button Content="_Save" HorizontalAlignment="Right" Margin="0,0,10,10" VerticalAlignment="Bottom" Width="75" 
                Command="{Binding SaveCommand}"/>
        
        
        
        
       
        
        
        
        
    </Grid>
</UserControl>
